package requestManager;

import java.io.File;
import java.util.List;
import java.util.Map;

import network.NetworkServerClientRequestHandler;

import model.Filter;
import model.EmailImp;
import model.EmailApplicationModelImp;
import model.MeetingInfo;
import model.Template;
import model.User;

/**
 * 
 * This is an interface created to structure the instances of EmailApplicationController objects.
 *
 */

public interface EmailApplicationRequestManagerImp 
{
    /**
     * to register the model component of the application
     * @param model is the model component
     */  
    public void registerModel(EmailApplicationModelImp model);

    /**
     * to unregister the model component of the application
     */
	  public void unRegiserModel();
	  
	  /**
	   * @return This method returns model component reference of the application
	   */
	  public EmailApplicationModelImp getModel();
	  
	  /**
       * to request to check if the given password matches with the email id
	   * @param emailID email id
	   * @param password password
       * @return to request to check if the given password matches with the email id
	   */
	  public boolean requestIsValidUser(String emailID, String password);
	  
	  
	 /**
      * to set the current user in the system
	  * @param emailId the email id
	  */
	  public void loginSuccess(String emailId);
	  
	    /**
	     * to get the current user in the system
	     * @return user
	     */
	  public String getUser();
	  
	  /**
	   * to request to check if the email id is registered, return yes if registered, otherwise return no
	   * @param emailId the email id
	   * @return if email register return true, otherwise false
	   */
	  public boolean requestIsEmailIdRegistered(String emailId);
	  
	    /**
         * to request the email persistence files form the given path with iterating into other folders
	     * @param path the given path
	     * @return list of files
	     */
	    public List<File> requestEmailFilesDeepInsideFolder(String path);
	    
	    /**
         * to request the email persistence files form the given path without iterating into other folders
	     * @param path the given path
	     * @return list of files
	     */
	    public List<File> requestEmailFilesFromFolder(String path);
	    
	    /**
         * to request creation of file in the given path
	     * @param path the given path
	     */
	    public void requestCreateFile(String path);
	    
	    /**
         * to request copy of file from source path to the destination path
	     * @param sourceFilePath the source path
	     * @param destrinationFilePath the destination path
	     */
	    public void requestCopyFile(String sourceFilePath, String destrinationFilePath);
	    
	    /**
         *  to request to move the file from one path to another path
	     * @param sourceFilePath the source path
	     * @param destrinationFilePath the destination path
	     */
	    public void requestMoveToFile(String sourceFilePath, String destrinationFilePath);
	    
	    /**
         * to request to delete the files under given path
	     * @param path the given path
	     */
	    public void requestDeleteFiles(String path);
	    
	    /**
         * to request to delete the file under given path
	     * @param fileToDeletePath the given file path
	     * @return return true if deleted successful, otherwise false
	     */
	    public boolean requestFileDelete(String fileToDeletePath);
	    
	    /**
         * to request to persist the user information like email id, password and other necessary components
	     * @param user the user
	     */
	    public void requestPersitUser(User user);
	    
	    /**
         * to request to persist the user information like email id, password and other necessary components
	     * @param eMail the email
	     * @param persistPath the persistence path
	     */
	    public void requestPersitEmail(EmailImp eMail, String persistPath);
	    
	    /**
	     * request template(s) from persistence
	     * @param path the given path
	     * @return list of Template(s)
	     */
	    public List<Template> requestTemplatesFromPersistence(String path);
	    
	    /**
	     * request to persist template
	     * @param template the given template
	     * @param path the given path
	     */
	    public void requestPersistTemplate(Template template, String path);
	    
	    /**
	     * request to persist filter
	     * @param filter the given filter to persist
	     * @param path the given path
	     */
	    public void requestPersistFilter(Filter filter, String filterPath);
	    
	    /**
	     * request search result from the given query data
	     * @param user the suer
	     * @param query the query keyword
	     * @param isRegEx boolean value to mark if it is a regular expression or general search
	     * @return the list of files
	     */
	    public List<File> requestSearchResult(String user, String query, boolean isRegEx);
	    
	    /**
	     * @param user the user
	     * @param query the query keyword
	     * @param SearchType the search type
	     * @return the map of search result
	     */
	    public Map<String,File> requestAdvancedSearchResult(String user, String query, int SearchType);
	    
	    /**
         * request filter(s) from persistence
         * @param path the given path
         * @return the list of filter(s)
         */
	    public List<Filter> requestFiltersFromPersistence(String path);
	    
	    /**
         * A method to take three HashMap objects, merge them and return the merged map as a linked list of values.
	     * @param mapOne the map to merge
	     * @param mapTwo the map to merge
	     * @param mapThree the map to merge
	     * @return the list after the merge
	     */
	    public List<File> mergeAndConvertToList(Map<String,File> mapOne,Map<String,File> mapTwo,Map<String,File> mapThree );

	    /**
	     * Callback for email receival in the OUTBOX
	     * @param emailFilePath the given file path
	     */
        public void emailReceivedToOutbox(String emailFilePath);

        /**
         * request to convert JSON to EmailImpl
         * @param path the given file path
         * @return the EmailImp object
         */
		public EmailImp requestEmailFromJson(String path);
		
		/**
		 * get network handler reference
		 * @return return network handler reference
		 */
	    public NetworkServerClientRequestHandler getNetworkHandler();

	    /**
	     * a request to persist meeting informaiton
	     * @param info meeting information place holder object
	     * @param path the given path to persist
	     */
	    public void requestPersistMeetingInfo(MeetingInfo info, String path);

	    /**
	     * a request to fetch all the meeting information files in the given path
	     * @param rootFolderPath the given path
	     * @return list of Meeting information object(s)
	     */
        public List<MeetingInfo> requestAllMeetingInfo(String rootFolderPath);
        
        /**
         * a request to fetch meeting information from the given path
         * @param meetingPath meeting information file path
         * @return the MeetingInfo object
         */
        public MeetingInfo requestMeetingInfo(String meetingPath);


}
